package com.edfu.core.institutemgt.persistence.entity;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.edfu.core.coursemgt.persistence.entity.AcadSemCourseBranchRelnEntity;

/**
 * 
 * @author sahsharm
 *
 */
@Entity
@Table(name="semester_branch")
public class AcadSemBranchRelnEntity implements IInstituteMgtEntity {
	private long id;
	private AcadSemEntity semester;
	private BranchEntity branch;
	private Set<AcadSemCourseBranchRelnEntity> coursesInGivenSem;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	
	@ManyToOne
	@JoinColumn(name = "semester_id", nullable = true)
	public AcadSemEntity getSemester() {
		return semester;
	}
	public void setSemester(AcadSemEntity semester) {
		this.semester = semester;
	}
	
	@ManyToOne
	@JoinColumn(name = "branch_id", nullable = false)
	public BranchEntity getBranch() {
		return branch;
	}
	public void setBranch(BranchEntity branch) {
		this.branch = branch;
	}
	
	@OneToMany(mappedBy = "semInBranch", fetch= FetchType.EAGER)
	public Set<AcadSemCourseBranchRelnEntity> getCoursesInGivenSem() {
		return coursesInGivenSem;
	}
	public void setCoursesInGivenSem(
			Set<AcadSemCourseBranchRelnEntity> coursesInGivenSem) {
		this.coursesInGivenSem = coursesInGivenSem;
	}
	
	
}
